package org.lim.infrastructure.config;

import org.lim.infrastructure.interception.JwtInterception;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration
public class WebConfig implements WebMvcConfigurer {
//    @Autowired
//    private  InterceptionDemo interceptionDemo;

//    @Autowired
    private JwtInterception jwtInterception;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(this.jwtInterception)
                .addPathPatterns("/**")  // Remove the /api prefix
                .excludePathPatterns(
                        "/user/login",
                        "/user/logout",
                        "/user/register",
                        "/upload",
                        // Knife4j documentation paths
                        "/doc.html",
                        "/webjars/**",
                        "/v2/api-docs",
                        "/swagger-resources/**",
                        "/favicon.ico"
                );
    }
}